//表单验证规则
let form = layui.form;
form.verify({
    pass: [/^[\S]{6,12}$/, '密码必须6到12位，且不能出现空格'],
    same: function (value) {
        if ($('.password').val() != value) {
            return '两次输入密码必须一致！'
        }
    }
});

//提交功能
$('form').on('submit', function (e) {
    e.preventDefault();
    let data = $(this).serialize();
    $.ajax({
        type: 'POST',
        url: 'admin/users',
        data: data,
        success: function (res) {
            //console.log(res)
            layer.msg(res.message);
            if (res.status === 0) {
                $('form')[0].reset();
            }
        }
    })
})